﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Collections;
using System.Data;
using CE.Database;

/// <summary>
/// Summary description for PLEmployemntDB
/// </summary>
/// 
namespace CE.PersonalLoan
{
    public class PLEmploymentDB
    {
        public PLEmploymentDB()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public Int64 Insert(PLEmployment plemployment)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocPLApplicantEmploymentInsertUpdateSingleItem";

            SortedList _sPara = new SortedList();

            _sPara.Add("@PLEmpId", plemployment.PLEmpId);
            _sPara.Add("@PLPersonnelId", plemployment.PLPersonnelId);
            _sPara.Add("@PLId", plemployment.PLId);
            _sPara.Add("@PLOccupation", plemployment.PLEmpOccupation);
            _sPara.Add("@PLIndBusType", plemployment.PLIndBusiType);
            _sPara.Add("@PLEmpBusName", plemployment.PLEmpBusiName);
            _sPara.Add("@PLEmpBusNature", plemployment.PLEmpBusiNature);
            _sPara.Add("@PLPosition", plemployment.PLPosition);
            _sPara.Add("@PLServiceYears", plemployment.PLServiceYears);
            _sPara.Add("@PLServiceMonths", plemployment.PLServiceMonths);
            _sPara.Add("@PLEmpUnitNo", plemployment.PLEmpUnitNo);
            _sPara.Add("@PLEmpHomeNo", plemployment.PLEmpHomeNo);
            _sPara.Add("@PLEmpStreetName", plemployment.PLEmpStreetName);
            _sPara.Add("@PLEmpCountry", plemployment.PLEmpCountry);
            _sPara.Add("@PLEmpPostalCode", plemployment.PLEmpPostalCode);
            _sPara.Add("@PLAnualIncome", plemployment.PLAnualIncome);
            _sPara.Add("@PLOtherIncome", plemployment.PLOtherIncome == true ? 1 : 0);
            _sPara.Add("@PLOtherIncomeAmount", plemployment.PLOtherIncomeAmt);
            _sPara.Add("@PLOtherIncomeSource", plemployment.PLOtherIncomeSource);

            _sPara.Add("@ViewedDetailId", plemployment.ViewedDetailId);
            _sPara.Add("@Status", plemployment.PLStatus == true ? 1 : 0);
            _sPara.Add("@Info1", plemployment.PLInfo1);
            _sPara.Add("@Info2", plemployment.PLInfo2);
            _sPara.Add("@Info3", plemployment.PLInfo3);
            _sPara.Add("@Info4", plemployment.PLInfo4);
            _sPara.Add("@Info5", plemployment.PLInfo5);

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }
    }
}